<template>
    <div>
        <div><input type="text" placeholder="Email" v-model="user"/></div>
        <div><input type="password" placeholder="密码" v-model="pwd"/></div>
        <div @click="submit">登录</div>
    </div>
</template>
<script>
import axios from 'axios'
export default {
    data(){
        return {
            user:'',
            pwd:''
        }
    },
    methods:{
        submit(){
            const {user,pwd} = this
            axios.post('/login/user',{user,pwd}).then(data=>{
                if(data.data.code === 1){
                    this.$router.push('/home')
                    return
                }
                alert(data.data.msg)
            })
        }
    }
}
</script>